package nowcoder;

import java.util.Scanner;

/**
 * Created by Administrator on 2017/3/23.
 */
public class BalanceNum {
    public static int getProduct(int num) {
        int res =1;
        if(num==0){
            return 0;
        }
        while(num!=0){
            res = res*(res%10);
            res = res/10;
        }
        return res;
    }

    public static void main(){
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()){
            int input = scanner.nextInt();



        }
        scanner.close();
    }
    public static void main(String[] args){
        System.out.println(getProduct(123));
    }
}
